package com.alibaba.otter.manager.web.resource;

import com.alibaba.otter.manager.web.dto.RestResponse;
import com.alibaba.otter.manager.web.dto.StageStatDTO;
import com.alibaba.otter.manager.web.service.StageStatAggService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/api/v1/stage-stat")
@RestController
public class StageStatResource {



    private final StageStatAggService stageStatAggService;


    public StageStatResource(StageStatAggService stageStatAggService) {
        this.stageStatAggService = stageStatAggService;
    }


    @GetMapping("")
    public RestResponse<StageStatDTO> stageStat(@RequestParam("pipelineId")Long pipelineId) {
        return RestResponse.ok(stageStatAggService.stageStat(pipelineId));
    }
}
